package com.qidian.buy.controller;

import com.qidian.buy.entity.Specifications;
import com.qidian.buy.service.ISpecificationsService;
import com.qidian.buy.util.pojo.LayuiTableDTO;
import com.qidian.buy.util.pojo.QDResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author 郭浩
 */
@RestController
@RequestMapping("/specifications")
@CrossOrigin
public class SpecificationsController {
    @Resource
    private ISpecificationsService specificationsService;
    @RequestMapping("/save")
    public QDResult save(Specifications specifications){
        return specificationsService.save(specifications);
    }
    @RequestMapping("/edit")
    public QDResult edit(Specifications specifications){
        return specificationsService.edit(specifications);
    }
    @RequestMapping("/delete")
    public QDResult delete(Specifications specifications){
        return specificationsService.delete(specifications);
    }
    @RequestMapping("/get")
    public QDResult<Specifications> save(Long id){
        return specificationsService.get(id);
    }
    @RequestMapping("/query")
    public LayuiTableDTO<Specifications> query(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10")int limit, Specifications specifications){
        LayuiTableDTO<Specifications> result =specificationsService.query(page, limit, specifications);
        return result;
    }
    @RequestMapping("/queryAll")
    public QDResult queryAll(){
        QDResult result =specificationsService.queryAll();
        return result;
    }

}
